<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.w3.org/MarkUp/SCHEMA/xhtml11.xsd"
     xml:lang="en">
  <head>
    <title>Information Center for ARM</title>
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
    <link type="text/css" rel="stylesheet" media="all" href="file://$TOOLKIT_DIR$/doc/infocenter/style/ewic.css" />
  </head>
  <body>
  <div id="topbanner"></div>
  <div id="titlebanner_small">
    <h2>Information Center for ARM</h2>
  </div>
  <div class="breadcrumb"><a href="$TOOLKIT_DIR$/doc/infocenter/index.ENU.html">Information Center for ARM</a> | EXAMPLES</div>
  <div class="mainblock">
   <h2>Example description</h2>

   <pre>  <!--Insert readme.txt-->
PWM Dual edges

Purpose:
	This is a simple example about PWM function on LPC17xx.
	This program illustrates the PWM signal on 3 Channels in both edge mode
	and single mode.
	Peripheral clock for PWM: PWM_PCLK = CCLK / 4 = 72MHz/4 = 18MHz and there is no
	prescale for PWM. The PWM timer/counter clock is at 18MHz. The base rate is set to 100
	The base PWM frequency is at 18MHz/100 = 180 KHz.
	Each PWM channel will be configured as following:
	- Channel 2: Double Edge
	- Channel 4: Double Edge
	- Channel 5: Single Edge
	The Match register values are as follows:
	- MR0 = 100 (PWM rate)
	- MR1 = 41, MR2 = 78 (PWM2 output)
	- MR3 = 53, MR4 = 27 (PWM4 output)
	- MR5 = 65 (PWM5 output)
	PWM Duty on each PWM channel:
	- Channel 2: Set by match 1, Reset by match 2.
	- Channel 4: Set by match 3, Reset by match 4.
	- Channel 5: Set by match 0, Reset by match 5.
	Using Oscilloscope to observe the PWM signals
	Using UART0 with this configuration - 115200bps - 8 data bit - No parity - 1 stop bit - No flow control 
	to display this conversion.

Hardware configuration:
	This example tested on Keil MCB2300 platform v4.0 with LPC1768
	These jumpers must be configured as following:
		- VBUS, LED must be closed.
		- All remaining jumpers must be opened.

Running mode:
	This example can run on RAM mode with a debugger or run on FLASH after burning.
	
Note:
	None
		
-----------------------------------------------------------------------------------
PWM Match Interrupt


Purpose:
	This is a simple example about PWM function on LPC17xx.
	This program illustrates the PWM signal on 6 Channels in single edge mode
	 Peripheral clock for PWM: PWM_PCLK = CCLK / 4 = 72MHz/4 = 18MHz and there is no
	 prescale for PWM. The PWM timer/counter clock is at 18MHz. The base rate is set to 256
	 The base PWM frequency is at 18MHz/256 = 70.312 KHz (Period = ~14.22 microsecond)
	 Each PWM channel (1 to 6) will be configured as following:
	 + PWM1.1 = (10/256) (period = 0.56 microsecond)
	 + PWM1.2 = (20/256) (period = 1.11 microsecond)
	 + PWM1.3 = (30/256) (period = 1.67 microsecond)
	 + PWM1.4 = (40/256) (period = 2.22 microsecond)
	 + PWM1.5 = (50/256) (period = 2.78 microsecond)
	 + PWM1.6 = (60/256) (period = 3.33 microsecond)
	 Using Oscilloscope to observe the PWM signals
	 Here, PWM1.1 value is not stable, it will increase by the time from 0 to 256 period
	 and restart. Match interrupt for channel 0 is set, when timer of PWM reach to 256
	 (value of channel 0 match), an interrupt for matching will generate and update the
	 value of PWM1.1, this value will be updated every 4096 match interrupts or:
	 Period * 4096 = 14.22 * 4096 = 58,245 (microsecond)
	 And this value will be reset to 0 after:
	 Period * 4096 * 256 = 14,910,750.72 (microsecond) = ~15 (second)
	Using UART0 with this configuration - 115200bps - 8 data bit - No parity - 1 stop bit - No flow control 
	to display this conversion.

Hardware configuration:
	This example tested on Keil MCB2300 platform v4.0 with LPC1768
	These jumpers must be configured as following:
		- VBUS, LED must be closed.
		- All remaining jumpers must be opened.

Running mode:
	This example can run on RAM mode with a debugger or run on FLASH after burning.
	
Note:
	None
		
-----------------------------------------------------------------------------------
PWM Single Edge

Purpose:
	This is a simple example about PWM function on LPC17xx.
	This program illustrates the PWM signal on 6 Channels in single edge mode
		 Peripheral clock for PWM: PWM_PCLK = CCLK / 4 = 72MHz/4 = 18MHz and there is no
		 prescale for PWM. The PWM timer/counter clock is at 18MHz. The base rate is set to 256
		 The base PWM frequency is at 18MHz/256 = 70.312 KHz (Period = ~14.22 microsecond)
		 Each PWM channel (1 to 6) will be configured as following:
		 + PWM1.1 = (10/256) (period = 0.56 microsecond)
		 + PWM1.2 = (20/256) (period = 1.11 microsecond)
		 + PWM1.3 = (30/256) (period = 1.67 microsecond)
		 + PWM1.4 = (40/256) (period = 2.22 microsecond)
		 + PWM1.5 = (50/256) (period = 2.78 microsecond)
		 + PWM1.6 = (60/256) (period = 3.33 microsecond)
		 Using Oscilloscope to observe the PWM signals
	Using UART0 with this configuration - 115200bps - 8 data bit - No parity - 1 stop bit - No flow control 
	to display this conversion.

Hardware configuration:
	This example tested on Keil MCB2300 platform v4.0 with LPC1768
	These jumpers must be configured as following:
		- VBUS, LED must be closed.
		- All remaining jumpers must be opened.

Running mode:
	This example can run on RAM mode with a debugger or run on FLASH after burning.
	
Note:
	None
	
			  </pre>

  </div>
  </body>
</html>






